package ntu.metaweb.result;

import java.util.Iterator;
import java.util.Vector;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

@XStreamAlias("xmlresponse")
public class PagesWithTag {
	protected int returncode;
	protected String tag;
	@XStreamImplicit
	protected Vector<Page> pages;
	
	public PagesWithTag(ntu.metaweb.storage.PagesWithTag pageswithtag) {
		returncode = 1;
		tag = pageswithtag.getTag();
		pages = new Vector<Page>();
		Iterator<ntu.metaweb.storage.Tag> iter = pageswithtag.getPagesTag();
		while (iter.hasNext()) {
			ntu.metaweb.storage.Tag temp = iter.next();
			pages.add(new Page(temp, pageswithtag.getPageTitle(temp.getURL()), 
					pageswithtag.getRating(temp.getURL())));
		}
	}
}
